# -*- coding:utf-8 -*-
import jsonschema
resp = {
    "name":"还是沈老师",
    "age":18,
    "hobby":["干饭","睡觉"],
    "is_girl":False,
    "score":{"python":60,"接口测试":66}
        }
schema = {
    "type": "object",
    "propertise":{
        "name": {"type":"string"},
        "age": {"type":"integer"},
        "hobby": {"type": "array"},
        "is_girl": {"type":"boolean"},
        "score": {"type":"object",
                  "propertise":{
                "python":{"type":"integer"},
                "接口测试":{"type":"integer"}
                  }}
    },
    "reuired":["name","score","hobby","is_girl"]
    }
#调用jsonschema中校验方法，校验数据
res = jsonschema.validate(instance =resp,schema = schema)
print(res)














